<template>
  <div>
    <a-card :bordered="false">
      <f-search-form :more="true" @searchHandler="searchHandler">
        <f-search-form-item label="单号" name="orderNo" style="width: 250px"/>
        <f-search-form-item label="供货方" name="supplierId" type="select" :data="api.supplier.list" valueKey="supplierId" label-key="supplierName"/>
        <f-search-form-item label="发货日期(起)" type="date" slot="advanced" name="beginDate" />
        <f-search-form-item label="发货日期(止)" type="date" slot="advanced" name="endDate" />
      </f-search-form>
      <a-tabs @tabClick="tabClick" :defaultActiveKey="current" v-model="current">
        <a-tab-pane tab="未垫付" key="form1">
          <supplier-bond-no ref="form1"  v-if="current=='form1'"></supplier-bond-no>
        </a-tab-pane>
        <a-tab-pane tab="审批中" key="form2" >
          <supplier-bond-yes ref="form2" v-if="current=='form2'"></supplier-bond-yes>
        </a-tab-pane>
        <a-tab-pane tab="已垫付" key="form3" >
          <supplier-bond-end ref="form3" v-if="current=='form3'"></supplier-bond-end>
        </a-tab-pane>
      </a-tabs>
    </a-card>
  </div>
</template>
<script>

  import api from './../js/api'
  import SupplierBondNo from './tab1'
  import SupplierBondYes from './tab2'
  import SupplierBondEnd from './tab3'

  export default {
    name: 'Tabs',
    components: { SupplierBondNo, SupplierBondYes,SupplierBondEnd },
    data() {
      let me = this
      return {
        api: Object.assign(api, this.api),
        //列表初始化查询参数
        queryParam: {},
        current: 'form1',
        forms: [
          'form1',
          'form2',
          'form3',
        ]
      }
    },
    created() {
    },
    methods: {
      tabClick(name) {
        this.current = name
        this.$nextTick(() => {
          //this.refs[this.current].setData(this.formData)
          this.searchHandler()
        })
      },
      searchHandler(searchParams) {
        this.$refs[this.current].searchHandler(searchParams)
      }
    }
  }
</script>
